#pragma once
#include<iostream>
using namespace std;

namespace Date
{
	class Time
	{

		friend ostream& operator<<(ostream& out,const Time& t);
		friend istream& operator>>(istream& in, Time& t);
	public:
		
		//构造函数进行初始化
		Time(int year = -1, int month = -1, int day = -1, int week = -1, int zodiac = -1);

		//拷贝构造函数
		Time(const Time& tmp)
		{
			_year = tmp._year;
			_month = tmp._month;
			_day = tmp._day;
			_week = tmp._week;
			_zodiac = tmp._zodiac;
		}

		//析构函数
		~Time()
		{
			_year = 0;
			_month = 0;
			_day = 0;
			_week = 0;
			_zodiac = 0;
		}

		//Time& operator=(Time& t);

		//+=支持连+=且需要更新星期
		Time& operator+=(int day);

		//+
		Time operator+(int day);

		//-=支持连-=且需要更新星期
		Time& operator-=(int day);

		//-=支持连-=且需要更新星期
		Time operator-(int day);

		//前置++天
		Time& operator++();

		//后置++天
		Time operator++(int);

		//前置--天
		Time& operator--();

		//后置--天
		Time operator--(int);

		//-=支持连-=且需要更新星期
		int operator-(const Time& t);

		bool operator==(const Time& t) const;

		bool operator!=(const Time& t) const;

		bool operator<(const Time& t) const;

		bool operator<=(const Time& t) const;

		bool operator>(const Time& t) const;

		bool operator>=(const Time& t) const;


	private:
		int _year;
		int _month;
		int _day;
		int _week;
		int _zodiac;

		//通过年月获取当月天数
		int GetDay(int year, int month);

		//根据时差获得星期
		int GetWeekZodiac();

	};

	class Main:Time
	{
	public:
		void MainProgram();
	private:
		void Menu(Time& t);

		void Menu();

		//计算日期函数(2功能)
		void DateCal();

		//计算区间日期函数(3功能)
		void DateValCal(Time& t);

		void DaysLived(Time& t);

		void ModeTime(Time& t);
	};

	//重载流插入打印日期-cout的别名out
	ostream& operator<<(ostream& out,const Time& t);

	//重载流提取输入日期-cin的别名in
	istream& operator>>(istream& in, Time& t);
}

